import request from '#/utils/requestAbort.js';

type ObjType = Record<string, any>;

// 场站基础信息表格数据
export async function getStationList(params: ObjType) {
  return request('/generation-common/stationInfo/page', {
    method: 'POST',
    data: params,
  });
}

// 导入模板下载
// export async function getTemplate() {
//   return request('/generation-common/stationInfo/template', {
//     method: 'GET',
//     responseType: 'blob',
//   });
// }

// 导入模板
export const getTemplateUrl = '/generation-common/stationInfo/template';

// 导出
export async function exportList(params: string[]) {
  return request('/generation-common/stationInfo/export', {
    method: 'POST',
    responseType: 'blob',
    data: {
      stationIdList: params,
    },
  });
}

// 导入
// export async function importList(data: ObjType) {
//   return request(`/generation-common/stationInfo/import`, {
//     method: 'POST',
//     data,
//   });
// }
export const importList = '/generation-common/stationInfo/import';

// 获取场站位置
export async function stationAddressList() {
  return request('/generation-common/stationInfo/stationAddressList', {
    method: 'GET',
  });
}

// 获取发电类型列表
export async function stationTypeList() {
  return request('/generation-common/stationInfo/stationTypeList', {
    method: 'GET',
  });
}

// 编辑
export function updateStationInfo(data: ObjType) {
  return request('/generation-common/stationInfo/update', {
    method: 'POST',
    data,
  });
}

// 新增
export function addStationInfo(data: ObjType) {
  return request('/generation-common/stationInfo/add', {
    method: 'POST',
    data,
  });
}

// 删除
export function delStationInfo(stationId: string) {
  return request(`/generation-common/stationInfo/delete/${stationId}`);
}

export function queryBaseGroupList() {
  return request(`/generation-common/stationInfo/queryBaseGroupList`);
}
